/*
 *  modeldata.h
 *  BioBreak
 *
 *  Created by terry franguiadakis on 5/3/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *  
 *  Data reference for models and animations 
 *  use g_modeldata to access all models. 
 *  don't make instantiations of any of these classes. 
 */
#pragma once
#include <vector>
#include <string>


namespace ModelData {

struct Anim {
    enum AnimType {
        POS,SCALE,ROT,UVPOS,UVROT,UVSCALE,ATLAS,UNDEFINED
    };
    std::string name;
    std::vector<float>   from;
    std::vector<float>     to;
    float   duration;
    AnimType type;
};


struct Texture {
    enum TextureType {
        PNG,ATLAS
    };
    
    std::string name;
    TextureType type;
};

struct TextureAtlas : public Texture {
    int xs, ys;  
};

struct Sequence 
{
    std::string name;
    std::vector<std::string> animNames;
    std::vector<Sequence*> children;
    int loop;  
};

struct Geom {
    
    enum GeomType {
        QUAD, DEFAULT
    };
    Geom():type(DEFAULT){}
    
    GeomType type;
};

struct Model {
    
    Model(){
        name = "model";
        texture = 0;
        pos[0] = pos[1] = 0.0f;
        rot = 0.0f; 
        scale[0] = scale[1] = 1.0f;
    }
    
    std::string name;
    Texture* texture;
    std::vector<Sequence*> sequences;
    std::vector<Model*>    children;
    Geom  geom;
    float pos[2];
    float rot;
    float scale[2];
};
    
// where all anims and model references are stored.
struct Source 
{
    std::vector<Anim*> anims;
    std::vector<Model*> models;
    
    Model* addModel() {
        models.push_back(new Model());
        return models.back();
    }
    
    Anim* addAnim() {
        anims.push_back(new Anim());
        return anims.back();
    }
};
} // modeldata scope 

static ModelData::Source g_modelData;
